package com.jboost.hyk.common.constant;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import com.jboost.common.constant.CommonConstant;
import com.jboost.common.constant.EnumInterface;

/**
 *@ClassName
 *@Description 教学课程的状态：定制中-customizing；待审批-padding；已完成-complete；
 *@Author cxn
 *@Date 2022-11-26
 *@Version
 **/
public enum TeachingCourseStatusEnum implements EnumInterface {
//  状态：定制中-customizing；待审批-padding；已完成-complete；
    CUSTOMIZING("customizing", "定制中"),
    PADDING("padding", "待审批"),
    REJECT("reject", "已驳回"),
    COMPLETE("complete", "已完成");

    TeachingCourseStatusEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    @EnumValue
    @JsonValue    //标记响应json值
    private final String code;
    private final String desc;

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
    public static TeachingCourseStatusEnum getByCode(String code) {
        TeachingCourseStatusEnum[] enums = TeachingCourseStatusEnum.values();
        for (int i = 0; i < enums.length; i++) {
            if(enums[i].code.equals(code)){
                return enums[i];
            }
        }
        return null;
    }
    public static String getDescByCode(String code) {
        if(null == code){
            return CommonConstant.UNDIFIND_DEFALUT;
        }
        TeachingCourseStatusEnum status = TeachingCourseStatusEnum.getByCode(code);
        if(null == status){
            return CommonConstant.UNDIFIND_DEFALUT;
        }
        return status.getDesc();
    }

    @Override
    public String desc() {
        return this.desc;
    }

    @Override
    public Integer value() {
        return null;
    }

    @Override
    public String code() {
        return this.code;
    }

}
